<template>
    <div class="approve-record">
        <modal v-model="value" width="832" :closable="false" :mask-closable='false'>
            <div slot="header" style="font-size: 24px;font-weight: bolder;">
                {{contractNo+'日志列表'}}
            </div>
            <Table :columns="columns" :data="dataList" border ref="recordTable" height="300"
                   width="800" closeable="false " :loading="loading"/>
            <div slot="footer">
                <Button type="text" @click="cancel">关闭</Button>
            </div>
            <div v-show="queryFlag"></div>
        </modal>
    </div>
</template>

<script>
    import {listAllRecord} from "@/projects/afs-core-business/api/afs-case/loan-approve-record/LoanApproveRecord";

    export default {
        name: "loan-approve-record",
        props: {
            value: {
                type: Boolean,
                default: false
            },
            contractNo: {
                type: [Number, String],
                default: ''
            },
            applyNo: {
                type: [Number, String],
                default: ''
            }
        },
        data() {
            return {
                columns: [
                    {
                        title: "节点名称",
                        key: "disposeNodeName",
                        align: "center",
                        minWidth: 120,
                    },
                    {
                        title: "处理人",
                        key: "disposeStaff",
                        align: "center",
                        minWidth: 100,
                    },
                    {
                        title: "处理命令",
                        key: "approveSuggestName",
                        align: "center",
                        minWidth: 100,
                    },
                    {
                        title: "到岗时间",
                        key: "approveStartTime",
                        align: "center",
                        type: 'datetime',
                        minWidth: 160,
                    },
                    {
                        title: "处理时间",
                        key: "approveEndTime",
                        align: "center",
                        type: 'datetime',
                        minWidth: 160,
                    },
                    {
                        title: "处理意见",
                        key: "approveRemark",
                        align: "left",
                        minWidth: 300,
                    }
                ],
                dataList: [],
                loading: false
            }
        },
        methods: {
            init() {
                this.loading = true;
                console.log(this.contractNo)
                listAllRecord({contractNo: this.contractNo,applyNo: this.applyNo}).then(res => {
                    if (res.code == "0000") {
                        this.dataList = res.data;
                    }
                    this.loading = false;
                });
            },
            cancel() {
                this.dataList = [];
                this.$emit('input', false);
                this.$emit('cancel');
            }
        },
        computed: {
            queryFlag: function () {
                if (this.value && this.applyNo) {
                    this.init();
                }
                return this.value;
            }
        }
    }
</script>

<style scoped>

</style>
